package com.eudon.design_pattern.behavioral.observer.simple;

import java.util.List;

/**
 * @author eudon
 * @description 用户注册控制器(被观察者)
 * @date 2025/9/2
 * @email syd19970616@gmail.com
 * @address <a href="https://gitee.com/eudon">Gitee</a>
 */
public class UserController {
    private final List<Observer> observers ;

    public UserController(List<Observer> observers) {
        this.observers = observers;
    }

    public void createUser(){
        //1.注册用户
        System.out.println("创建用户成功");
        //2.通过观察者给用户发送体验金
        for (Observer observer : observers) {
            observer.update();
        }
    }
}
